<%@page language="java" pageEncoding="UTF-8"
	contentType="text/html; charset=UTF-8"%>
<%@ include file="/view/common/taglib.jsp"%>
<%@ include file="/view/common/variable.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<%@ include file="/view/common/head.jsp"%>
<meta name="keywords" content="学而阅读,小说网,原创小说网" />
<meta name="description"
	content="学而阅读,最热门的免费小说网站,提供武侠仙侠,奇幻玄幻,科幻灵异,都市言情,穿越女频,青春校园,历史军事,网游竞技,职业官场等网络热门的书籍下载跟阅读！" />
<title>学而阅读作家后台</title>
<link rel="stylesheet" href="<%=path%>/css/style.css" />
<script type="text/javascript" src="<%=path%>/js/base.js"></script>
<script type="text/javascript">
	var tagArray;
	$(document).ready(function() {
		//作品标签点击弹框
		var arr = [];
		$('.worklabel ul').on('click', function() {
			bomb();
			$(".labelfd").fadeIn();

		});

		//标签选择
		$('.labelfdz ul li').on('click', function() {
			var type = $(this).attr("data-id");
			var copyThisB = $(this).clone();
			$(this).toggleClass("active");
			var length = $(".active").length;
			if (length > 5) {
				display("最多只能选择5个作为您的作品标签");
				$(this).removeClass("active");
			} else {
				if (!$(this).hasClass("active")) {
					$(".worklabel ul li[data-id='" + type + "']").remove();
					arr.splice($.inArray(type, arr), 1);
					// 	            alert(arr);
				} else {
					$(".worklabel ul").append(copyThisB);
					arr.push($(this).attr("data-id"));
					// 	         	alert(arr)
				}
			}
		});

		//标签确认
		$('.labela').on('click', function() {
			//alert(arr);
			tagArray = arr;
			$("#tagIds").val(tagArray);
			bombhide();
			$(".labelfd").hide();
		});

	});
	function submitForm() {
		var bookName = $.trim($("#bookName").val());
		var bookDesc = $.trim($("#bookDesc").val());
		if (bookName != "" && bookDesc != "") {
			$("#validInfo").text("");
			$("#form").submit();
		} else {
			$("#validInfo").text("请将信息填写完整!");
			return false;
		}
	}
</script>
</head>

<body ng-app="myApp" ng-controller='ShowController'>
	<%@ include file="/view/common/header.jsp"%>
	<div class="content clearfix">
		<%@ include file="/view/common/left.jsp"%>
		<!--右边-->
		<div class="right r">
			<div class="path">
				书籍管理 > <span>新增书籍</span>
			</div>
			<div class="seltype">
				<ul>
					<li><b>1</b><span>选择类型</span><i><img
							src="<%=path%>/image/arrow.png" /></i></li>
					<li class="seltypeo"><b>2</b><span>完善书籍信息</span><i><img
							src="<%=path%>/image/arrow.png" /></i></li>
					<li><b>3</b><span>申请成功</span></li>
				</ul>
			</div>

			<div class="perfect">
				<form action="<%=path%>/book/save" name="form" id="form"
					method="post">
					<table cellspacing="1" cellpadding="0" border="0" width="460">
						<tr>
							<td valign="top">书籍名称</td>
							<td class="zpname"><input type="text" id="bookName"
								name="bookName" /> <span>15字内，请勿添加书名号等特殊符号</span></td>
						</tr>
						<tr>
							<td valign="top">书籍分类</td>
							<td class="genre"><select id="bookCategoryId"
								name="bookCategoryId">
									<c:forEach items="${categoryList}" var="category"
										varStatus="status">
										<option value="${category.categoryId}">${category.categoryName}</option>
									</c:forEach>
							</select></td>
						</tr>
						<tr>
							<td valign="top">书籍标签</td>
							<td class="worklabel">
								<ul>

								</ul>
							</td>
						</tr>
						<tr>
							<td valign="top">默认封面</td>
							<td class="adefaultimg">
								<ul>
									<li><b><img src="<%=path%>/image/cover_1.jpg" /></b> <label><input
											type="radio" name="bookImage" value="1" checked="checked" /><span>默认封面1</span></label>
									</li>
									<li><b><img src="<%=path%>/image/cover_2.jpg" /></b> <label><input
											type="radio" name="bookImage" value="2" /><span>默认封面2</span></label></li>
									<li><b><img src="<%=path%>/image/cover_3.jpg" /></b> <label><input
											type="radio" name="bookImage" value="3" /><span>默认封面3</span></label></li>
								</ul>
							</td>
						</tr>
						<tr>
							<td valign="top">书籍简介</td>
							<td><textarea id="bookDesc" name="bookDesc"></textarea></td>
						</tr>
						<tr>
							<td></td>
							<td><span id="validInfo" style="color: red;"></span></td>
						</tr>
						<tr>
							<td></td>
							<td class="upsub"><a href="<%=path%>/book/add1">上一步</a><input
								type="submit" onclick="submitForm();return false;" value="提交" /></td>
						</tr>
					</table>
					<input type="hidden" value="" name="tagIds" id="tagIds" />
				</form>
			</div>

		</div>
		<!--右边-->
	</div>

	<div class="labelfd">
		<div class="labelfds">
			选择标签<s><img src="<%=path%>/image/close.png" /></s>
		</div>
		<div class="fivelabel">请选择最多5个作为您的作品标签</div>
		<div class="labelfdz">
			<b>风格</b>
			<ul>
				<c:forEach items="${tagList}" var="tag" varStatus="status">
					<li data-id="${tag.tagId}">${tag.tagName}</li>
				</c:forEach>
			</ul>
		</div>
		<a class="labela">确 认</a>
	</div>
</body>
</html>